import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";
import HomeFollow from "../views/HomeFollow.vue";
import FavoritesCookbook from "../views/FavoritesCookbookView.vue";
import FavoritesNote from "../views/FavoritesNote.vue";
import FavoritesCurriculum from "../views/FavoritesCurriculum.vue";
import HomeRecommend from "../views/HomeRecommend.vue";
import HomeNote from "../views/HomeNote.vue";
import HomeVedio from "../views/HomeVedio.vue";
import HomeActivity from "../views/HomeActivity.vue";
import FavoritesView from "../views/FavoritesView.vue";
import FavoritesManage from "../views/FavoritesManage.vue";
import MeView from "../views/MeView.vue";
import MeEdit from "../views/MeEdit.vue";
import MeLists from "../views/MeLists.vue";
import ByRecipe from "../views/ByRecipe.vue";
import AllLists from "../views/AllLists.vue";
import MeFriends from "../views/MeFriends.vue";
import MeFollow from "../views/MeFollow.vue";
import MeFans from "../views/MeFans.vue";
import MeBrowsed from "../views/MeBrowsed.vue";
import ClassificationView from "../views/ClassificationView.vue";
import SearchView from "../views/SearchView.vue";
import SearchedView from "../views/SearchedView.vue";
import SearchedCookbook from "../views/SearchedCookbook.vue";
import CookbookIntegrate from "../views/CookbookIntegrate.vue";
import CookbookCollection from "../views/CookbookCollection.vue";
import CookbookLearn from "../views/CookbookLearn.vue";
import CookbookVideo from "../views/CookbookVideo.vue";
import SearchedNote from "../views/SearchedNote.vue";
import SearchedUser from "../views/SearchedUser.vue";
import SearchedCommodity from "../views/SearchedCommodity.vue";
import SearchedCurriculum from "../views/SearchedCurriculum.vue";
import UserView from "../views/UserView.vue";
import UserCookbook from "../views/UserCookbook.vue";
import UserNote from "../views/UserNote.vue";
import UserCollect from "../views/UserCollect.vue";
import CookbookView from "../views/CookbookView.vue";
import NoteDetail from "../views/NoteDetail.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      component: HomeView,
      meta: { showFooter: true, keepAlive: true },
      children: [
        { path: "follow", name: "follow", component: HomeFollow },
        { path: "recommend", name: "recommend", component: HomeRecommend },
        { path: "note", name: "note", component: HomeNote },
        { path: "vedio", name: "vedio", component: HomeVedio },
        { path: "activity", name: "activity", component: HomeActivity },
      ],
      redirect: "/recommend",
    },
    {
      path: "/favorites",
      name: "favorites",
      component: FavoritesView,
      meta: { showFooter: true },
      children: [
        {
          path: "followCookbook",
          name: "followCookbook",
          component: FavoritesCookbook,
        },
        { path: "followNote", name: "followNote", component: FavoritesNote },
        {
          path: "curriculum",
          name: "curriculum",
          component: FavoritesCurriculum,
        },
      ],
      redirect: "/favorites/followCookbook",
    },
    {
      path: "/favoritesManage",
      name: "favoritesManage",
      component: FavoritesManage,
    },
    {
      path: "/me",
      name: "me",
      component: MeView,
      meta: { showFooter: true },
    },
    {
      path: "/classification",
      name: "classification",
      component: ClassificationView,
    },
    {
      path: "/search",
      name: "search",
      component: SearchView,
    },
    {
      path: "/searched",
      name: "searched",
      component: SearchedView,
      children: [
        {
          path: "/searched/searchedCookbook",
          name: "searchedCookbook",
          component: SearchedCookbook,
          children: [
            {
              path: "cookbookIntegrate",
              name: "cookbookIntegrate",
              component: CookbookIntegrate,
            },
            {
              path: "cookbookCollection",
              name: "cookbookCollection",
              component: CookbookCollection,
            },
            {
              path: "cookbookLearn",
              name: "cookbookLearn",
              component: CookbookLearn,
            },
            {
              path: "cookbookVideo",
              name: "cookbookVideo",
              component: CookbookVideo,
            },
          ],
          redirect: "/searched/searchedCookbook/cookbookIntegrate",
        },
        {
          path: "/searched/searchedNote",
          name: "searchedNote",
          component: SearchedNote,
        },
        {
          path: "/searched/searchedUser",
          name: "searchedUser",
          component: SearchedUser,
        },
        {
          path: "/searched/searchedCommodity",
          name: "searchedCommodity",
          component: SearchedCommodity,
        },
        {
          path: "/searched/searchedCurriculum",
          name: "searchedCurriculum",
          component: SearchedCurriculum,
        },
      ],
      redirect: "/searched/searchedCookbook/cookbookIntegrate",
    },
    {
      path: "/user",
      name: "user",
      component: UserView,
      children: [
        {
          path: "userCookbook",
          name: "userCookbook",
          component: UserCookbook,
        },
        {
          path: "userNote",
          name: "userNote",
          component: UserNote,
        },
        {
          path: "userCollect",
          name: "userCollect",
          component: UserCollect,
        },
      ],
      redirect: "/user/userCookbook",
    },
    {
      path: "/cookbook",
      name: "cookbook",
      component: CookbookView,
    },
    {
      path: "/meEdit",
      name: "meEdit",
      component: MeEdit,
    },
    {
      path: "/meLists",
      name: "meLists",
      component: MeLists,
      children: [
        { path: "byRecipe", name: "byRecipe", component: ByRecipe },
        { path: "allLists", name: "allLists", component: AllLists },
      ],
    },
    {
      path: "/meFriends",
      name: "meFriends",
      component: MeFriends,
      children: [
        { path: "meFollow", name: "meFollow", component: MeFollow },
        { path: "meFans", name: "meFans", component: MeFans },
      ],
    },
    {
      path: "/meBrowsed",
      name: "meBrowsed",
      component: MeBrowsed,
    },
    {
      path: "/noteDetail",
      name: "noteDetail",
      component: NoteDetail,
    },
  ],
});

export default router;
